package me.keiwu.log.dao;

import me.keiwu.log.domain.LogDonateStep;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by kei on 18/12/2017.
 */
public interface LogDonateStepDao extends JpaRepository<LogDonateStep, Long>, JpaSpecificationExecutor<LogDonateStep> {


    @Query(value = "select * from log_donate_step order by created_time limit ?1", nativeQuery = true)
    List<LogDonateStep> getTopN(Integer n);


    @Query(value = "select * from log_donate_step where created_time >= ?1 and created_time <= ?2", nativeQuery = true)
    List<LogDonateStep> findByCreatedTimeFromTo(Integer from, Integer to);

}
